﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Operators.CMOperators;
using Operators;
using Common;

namespace Satates.WaterCupState
{
    public class WaterCupState : Template
    {
        private int capacity1;
        private int capacity2;

        public WaterCupState()
        {
            capacity1 = 0;
            capacity2 = 0;
        }

        public static State initalState()
        {
            return new State(new WaterCupState(), (iOperator) new InitialState());
        }

        public static List<State> finalStates()
        {
            List<State> fStates = new List<State>();
            fStates.Add(new State(new WaterCupState(0, 2), null));
            fStates.Add(new State(new WaterCupState(1, 2), null));
            fStates.Add(new State(new WaterCupState(2, 2), null));
            fStates.Add(new State(new WaterCupState(3, 2), null));
            return fStates;
        }

        public object Clone()
        {
            return this.MemberwiseClone();
        }
        
        public WaterCupState(int c1, int c2)
        {
            capacity1 = c1;
            capacity2 = c2;
        }
        public int getCapacity1()
        {
            return capacity1;
        }
        public int getCapacity2()
        {
            return capacity2;
        }
        public void setCapacity1(int c1)
        {
            capacity1 = c1;
        }
        public void setCapacity2(int c2)
        {
            capacity2 = c2;
        }
        public override string ToString()
        {
            return "Cup 1 contains: " + capacity1 + "  Cup 2 contians: " + capacity2 + "\n";
        }
        public bool Equals(WaterCupState s)
        {
            if ((this.capacity1 == s.capacity1) && (this.capacity2 == s.capacity2))
                return true;
            return false;

        }
    }
}
